package hdfs;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;

import java.net.URI;

public class TestHdfs {
    public static void main(String[] args) throws Exception {
        Configuration conf = new Configuration();
        FileSystem fs  = FileSystem.get(new URI("hdfs://192.168.0.40:9000"),conf,"root");

        FileStatus[] fileStatuses = fs.listStatus(new Path("/"));
        for (FileStatus fss : fileStatuses){
            System.out.println(fss.getPath());
        }
    }
}
